<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>高校学籍管理系统</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"/>
    <!--<link rel="stylesheet" th:href="@{/css/frm_base.css}" />-->
    <script th:src="@{/js/jquery-3.5.1.js}"></script>

    <style>

        html{
            height: 100%;
        }
        body {
            background-size: cover;
            background-repeat: no-repeat;
            background-image: url("img/bg.jpg");
            height: 100%;
            padding: 0;
        }

        .main {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            flex-direction:column;
        }

        .main-body{
            box-shadow: 0 0 5px lightgrey;
            background-color: #fff;
        }

        .form-div {
            width: 400px;
        }

        .form-div form{
            padding: 20px;
        }

        .title{
            text-align: center;
            height: 30px;
            line-height: 30px;
            font-size: 25px;
            padding: 10px 0;
            color: rgb(0,152,139);
        }

    </style>

</head>
<body>
<div class="layui-container main">
    <div class="main-body">

        <div class="form-div">
            <div class="title">高校学籍管理系统</div>

            <form action="" class="layui-form layui-form-pane login" lay-filter="login">
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" lay-verify="required" placeholder="请输入手机号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" lay-verify="required" autocomplete="off" placeholder="请输入密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" type="button" lay-submit lay-filter="login">登录</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script th:src="@{/layui/layui.js}"></script>

<script>
    layui.use(['element', 'layer', 'form', 'jquery'], function () {
        var form = layui.form ,layer = layui.layer;

        // 登录
        form.on('submit(login)', function (data) {
            var user = form.val('login'); // 获取表单的数据
            console.log(user)
            $.post('/ssms/sys/login', user, function (res) {
                if (res.code == 200) {
                    window.location.href = "/ssms/sys/main"
                } else {
                    layer.msg(res.msg, {icon: 8, time: 2000});
                }
            })
            return false;
        });


    });
</script>

</body>
</html>